﻿<%@ Page Language="C#" MasterPageFile="~/Views\Home\test.master" Inherits="System.Web.Mvc.ViewPage" %>
 		<asp:Content ContentPlaceHolderID="test" runat="server">
 			<div class="tab_container">
   				
   				 
   				 <!-- ---------------- TAB 4 MANAGE USER (FOR ADMIN ONLY) ------------------------ -->
   				 
   				 <div id="tab4" class="tab_content">
   				 	
   				 	<div class="sub_content">ADD USER</div>
   				 	<div class="error" id="au_error">Cannot add user. Please fill up the necessary information.</div>
   				 	<div class="error" id="au_error_pass">Cannot add user. Passwords do not match.</div>
   				 	<div class="error" id="au_error_exist">Cannot add user. Username already exists.</div>	
   				 	<div class="error" id="au_error_email">Cannot add user. Invalid email or contact number. Please use your NSN email address.</div>		
   				 	<div class="success" id="au_success">User Added!</div>			  	
   				  	<form id="manage_books_form" class="form" action="" method="POST" >
   				  		<div class="mng_form"><label>Username:</label> <input class="mb_input" type="text" id="au_username" name="u_username" />
   				  		</div>
   				  		<div class="mng_form"><label>Password:</label> <input class="mb_input" type="password" id="au_pass" name="u_pass" />
   				  		</div>
   				  		<div class="mng_form"><label>Confirm Password:</label> <input class="mb_input" type="password" id="au_confirm" name="u_confirm" />
   				  		</div>
   				  		<div class="mng_form"><label>First Name:</label> <input class="mb_input" type="text" id="au_fname" name="u_fname" />
   				  		</div>
   				  		<div class="mng_form"><label>Last Name:</label> <input class="mb_input" type="text" id="au_lname" name="u_lname" />
   				  		</div>
   				  		<div class="mng_form"><label>Email:</label> <input class="mb_input" type="text" id="au_email" name="u_email" />
   				  		</div>
   				  		<div class="mng_form"><label>Contact Number:</label> <input class="mb_input" type="text" id="au_contact" name="u_contact" />
   				  		</div>
   				  		<div class="mng_form"><label>Level:</label>
   				  		<select class="mb_input" id="au_level" name="u_level" >
   				  			<option>User</option>
   				  			<option>Librarian</option>
   				  			<option>Admin</option>
   				  		</select>  				  		
   				  		</div>
   				  		<div class="mng_form"><input type="button" id="au_button" value="Add User" />
   				  		</div>
   				  	</form>
   				  	<br/> 
   				  	
   				  	<div class="sub_content">MODIFY/REMOVE USER</div>
	   				<form id="search_user_form" class="form" action="" method="">
	   					<label>Search:</label> <input class="mb_input" id="s_user" type="text"  /><br/>
	   				</form>
	   				<br/>
   				  	<div class="success" id="eu_success">User Edited!</div>
   				  	<div class="success" id="du_success">User Deleted!</div>
   				 	<div class="error" id="au_error_passs">Cannot edit user. Passwords do not match.</div>
   				 	<div class="error" id="au_error_emails">Cannot edit user. Invalid email or contact number. Please use your NSN email address.</div>
   				 	<div class="error" id="au_error_exists">Cannot edit user. Username already exists.</div>
   				  	<div id="form_editUser">
   				  	<table  width="100%" cellspacing="0">
   				  		<tr><td>UserID: </td><td><input size="35"  id="inp_userid" type="text" disabled="disabled" value="" /></td></tr>
   				  		<tr><td>Username: </td><td><input size="35" id="inp_username" type="text" value="" /></td></tr>
   				  		<tr><td>Password: </td><td><input size="35" id="inp_password" type="password" value="" /></td></tr>
   				  		<tr><td>Confirm Password: </td><td><input size="35"  id="inp_confirm" type="password" value="" /></td></tr>
   				  		<tr><td>First Name: </td><td><input size="35"  id="inp_firstname" type="text" value="" /></td></tr>
   				  		<tr><td>Last Name: </td><td><input size="35"  id="inp_lastname" type="text" value="" /></td></tr>
   				  		<tr><td>Email: </td><td><input size="35"  id="inp_email" type="text" value="" /></td></tr>
   				  		<tr><td>Contact Number: </td><td><input size="35"  id="inp_contactnumber" type="text" value="" /></td></tr>
   				  		<tr><td>Level: </td><td>
	   					<select id="inp_level" name="eu_level" >
	   						<option>User</option>
	   						<option>Librarian</option>
	   						<option>Admin</option>
	   					</select><br/></td></tr>
	   				</table>
	                <br/>
   				  		<input type="button" value="Edit" id="editUser"/>&nbsp; <input type="button" value="Cancel" id="cancel_editUser"/><br />
   				  	</div>
                    <br/>
   				  	<table width="100%" cellspacing="0">
   				  		<thead>
   				  			<td>Username</td>
   				  			<td>First Name</td>
   				  			<td>Last Name</td>
   				  			<td>Level</td>
   				  			<td style="width:15%;"></td>
   				  		</thead>   				  		
   				  		<tbody id="bt_user">
						<% foreach (TestProject.User item in (ViewData["Users"] as List<TestProject.User>)) {%>
						<tr id="<%= Html.Encode(item.username) %>_row" class="user_row">
							<td align="center" class="user_column" id="<%= Html.Encode(item.username) %>_username"><%= Html.Encode(item.username) %></td>
							<td align="center" class="user_column" id="<%= Html.Encode(item.username) %>_firstname"><%= Html.Encode(item.firstname) %></td>
							<td align="center" class="user_column" id="<%= Html.Encode(item.username) %>_lastname"><%= Html.Encode(item.lastname) %></td>
							<td align="center" class="user_column" id="<%= Html.Encode(item.username) %>_level"><% if (item.level==1){ %>User<% } %><% if (item.level==2){ %>Librarian<% } %><% if (item.level==3){ %>Admin<% } %></td>
							<td align="center"><a class="editUser_showForm" id="<%= Html.Encode(item.username) %>" href="#">edit</a>&nbsp;|&nbsp;<a class="deleteUser" id="<%= Html.Encode(item.username) %>" href="#">delete</a>
							<input name="<%= Html.Encode(item.username) %>_userid" id="<%= Html.Encode(item.username) %>_userid" type="hidden" value="<%= Html.Encode(item.user_ID) %>" />
							<input name="<%= Html.Encode(item.username) %>_email" id="<%= Html.Encode(item.username) %>_email" type="hidden" value="<%= Html.Encode(item.email) %>" />
							<input name="<%= Html.Encode(item.username) %>_contactnumber" id="<%= Html.Encode(item.username) %>_contactnumber" type="hidden" value="<%= Html.Encode(item.contactnumber) %>" /></td>
						</tr>
						<% } %>
						</tbody>

   				  	</table>
   				 </div>
   			</div>
 			
 		</asp:Content>
 	
 	
